package com.blockchain.console.servlets.financial.cz;

import java.math.BigDecimal;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.blockchain.console.service.financial.CzglManage;
import com.blockchain.console.servlets.financial.AbstractFinancialServlet;
import com.blockchain.framework.http.servlet.annotation.Right;
import com.blockchain.framework.resource.PromptLevel;
import com.blockchain.framework.service.ServiceSession;
import com.blockchain.util.parser.BigDecimalParser;
import com.blockchain.util.parser.IntegerParser;

@Right(id = "C_FINANCIAL_CZQRDZ", name = "人民币充值-确认到账")
public class CzRgqr extends AbstractFinancialServlet {
	private static final long serialVersionUID = 1L;

	@Override
	protected void processGet(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
			throws Throwable {
		processPost(request, response, serviceSession);
	}
	
	@Override
	protected void processPost(final HttpServletRequest request, final HttpServletResponse response,
			final ServiceSession serviceSession) throws Throwable {
		try {
			CzglManage recharge = serviceSession.getService(CzglManage.class);
			int id = IntegerParser.parse(request.getParameter("id"));
			int userid = IntegerParser.parse(request.getParameter("userid"));
			recharge.czQrdz(id, userid);
			sendRedirect(request, response, getController().getURI(request, CzglList.class));
		} catch (Exception e) {
			prompt(request, response, PromptLevel.ERROR, e.getMessage());
			sendRedirect(request, response, getController().getURI(request, CzglList.class));
		}
	}

}
